using System.Collections.Generic;
using UnityEngine;

public class RailSizeHandler : MonoBehaviour
{
	public List<GameObject> ObjectPerLevel;

	public Transform TransformToScale;

	public ConfigurableJoint JointToLimit;

	public GameObject FX;

	private static int _lastSize = -1;

	private void Start()
	{
		UpdateSize();
	}

	public void UpdateSize()
	{
		int @int = NintendoPlayerPrefs.GetInt("Long", 0);
		if ((bool)FX)
		{
			FX.SetActive(value: false);
			if (_lastSize != @int && _lastSize != -1 && @int > 0)
			{
				FX.SetActive(value: true);
			}
			_lastSize = @int;
		}
		if ((bool)TransformToScale)
		{
			Vector3 localScale = base.transform.localScale;
			localScale.x = @int + 1;
			base.transform.localScale = localScale;
		}
		if ((bool)JointToLimit)
		{
			SoftJointLimit linearLimit = JointToLimit.linearLimit;
			linearLimit.limit = Mathf.Max(0.5f, (float)@int * 2.4f);
			JointToLimit.linearLimit = linearLimit;
		}
		for (int i = 0; i < ObjectPerLevel.Count; i++)
		{
			ObjectPerLevel[i].SetActive(i < @int);
		}
	}
}
